﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.BaseData.ErrorCode
{
    public class ApiResult
    {
        public bool IsSuc {  get; set; }
        public ResultCode code { get; set; } = ResultCode.Fail;

        public string msg { get; set; } = "失败";

        public object data { get; set; }

        public void success(string msg ="成功")
        {
            this.IsSuc = true;
            this.msg = msg;
            this.code = ResultCode.Ok;
        }
    }
    public class ApiResult<T>
    {
        public bool IsSuc { get; set; }

        public ResultCode code { get; set; } = ResultCode.Fail;

        public string msg { get; set; } = "失败";

        public T data { get; set; }

        public void success(T data,string msg = "成功")
        {
            this.IsSuc = true;
            this.msg = msg;
            this.data = data;
            this.code = ResultCode.Ok;
        }
    }
}
